


// 获取鼠标在一个DOM上的相对位置
export const getRelMousePosition = (target: HTMLElement, e: MouseEvent) =>{
  const targetClientRect = target.getBoundingClientRect();
  return {
    top: e.clientY - targetClientRect.top,
    right: e.clientX - targetClientRect.left + targetClientRect.width,
    bottom: e.clientY - targetClientRect.top + targetClientRect.height,
    left: e.clientX - targetClientRect.left,
  }
}